---
title: "Analisis Multitemporal"
author: "Gorky Florez Castillo"
date: "15/12/2021"
output:
flexdashboard::flex_dashboard:
theme: paper
source_code: embed
---
```{r setup, include=FALSE}
#-----------------------------------Mapa-----------------------------
library(rgee)
library(googledrive)
library(rgee)
library(mapedit)
library(tibble)
library(sf)
library(cptcity)
library(tidyverse)
library(sp)
library(leaflet.extras2)
library(raster)
library(stars)
library(geojsonio)
ee_Initialize("gflorezc", drive = T)
#-----------------------------------Mapa-----------------------------
Con_Lazo <-ee$FeatureCollection("users/gflorezc/Con_Lazo")
#-----------------------------------Sentinel 2 2021---------------------------
sentinel2 <- ee$ImageCollection("COPERNICUS/S2")
Trueimage <-sentinel2$filterBounds(Con_Lazo)$
filterDate("2020-01-01", "2021-12-12")$
sort("CLOUDY_PIXEL_PERCENTAGE", FALSE)$
mosaic()$
clip(Con_Lazo)
trueColor <- list(min= 0,max= 3000, bands= c("B4","B3", "B2"))
NDVI <- Trueimage$normalizedDifference(c("B8", "B4"))
#-------------------------------LANDSAT 2013-04-26---------------------------
#coll <- ee$ImageCollection("LANDSAT/LC08/C01/T1_TOA")$
#filterDate("2013-01-01", "2014-12-1")$
#filterBounds(ee$Geometry$Point(-69.53934, -12.861))$
# filterMetadata("CLOUD_COVER", "less_than", 5)
#ee_get_date_ic(coll)
L8 <- ee$Image('LANDSAT/LC08/C01/T1_TOA/LC08_002069_20130426')$
clip(Con_Lazo)%>%
ee$Image$select(c("B6","B5", "B4"))
LAN_NDVI <- L8$normalizedDifference(c("B5", "B4"))
#-------------------------------LANDSAT 5 2008-08-25---------------------------
#coll <- ee$ImageCollection("LANDSAT/LT05/C01/T1_SR")$
#filterDate("2007-01-01", "2008-12-01")$
#filterBounds(ee$Geometry$Point(-69.53934, -12.861))$
# filterMetadata("CLOUD_COVER", "less_than", 5)
#ee_get_date_ic(coll)
L5 <- ee$Image('LANDSAT/LT05/C01/T1_SR/LT05_002069_20070731')$
clip(Con_Lazo)
trueCol <- list(min= 0,max= 3000,gamma=1.4, bands= c("B3","B2", "B1"))
LAN5_NDVI <- L5$normalizedDifference(c("B4", "B3"))
viz_ndvi <- list(palette=c('FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'))
#-------------------------------LANDSAT 5 2003-07-20---------------------------
#coll <- ee$ImageCollection("LANDSAT/LT05/C01/T1_SR")$
#filterDate("2003-01-01", "2004-12-01")$
#filterBounds(ee$Geometry$Point(-69.53934, -12.861))$
#filterMetadata("CLOUD_COVER", "less_than", 5)
#ee_get_date_ic(coll)
L5_2003 <- ee$Image('LANDSAT/LT05/C01/T1_SR/LT05_002069_20030720')$
clip(Con_Lazo)
trueCo <- list(min= 0,max= 3000,gamma=1.4, bands= c("B3","B2", "B1"))
L5_2003_NDVI <- L5_2003 $normalizedDifference(c("B4", "B3"))
viz_ndvii <- list(palette=c('FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'))
```
Google Earth Engine en RStudio
=====================================
Column {data-width=250}
-----------------------------------------------------------------------
### Mapa de imagen satelital Lansatd 5 2003 - NDVI
```{r}
Map$setCenter(-69.53968,-12.86636, zoom = 12)
Map$addLayer(L5_2003, visParams = trueCo) |
Map$addLayer(eeObject =L5_2003_NDVI , visParams = viz_ndvii)
```
### Mapa de imagen satelital Lansard 8 2013 - NDVI
```{r}
Map$setCenter(-69.53968,-12.86636, zoom = 12)
Map$addLayer(L8) |
Map$addLayer(eeObject =LAN_NDVI, visParams = list(
min=0.2,
max=0.8,
palette= cpt("grass_ndvi", 10)))
```
Column {data-width=250}
-----------------------------------------------------------------------
### Mapa de imagen satelital Lansat 5 2008 - NDVI
```{r}
Map$setCenter(-69.53968,-12.86636, zoom = 12)
Map$addLayer(L5, visParams = trueCol) |
Map$addLayer(eeObject =LAN5_NDVI, visParams = viz_ndvi)
```
### Mapa de imagen satelital sentinel2 2021 - NDVI
```{r}
Map$setCenter(-69.53968,-12.86636, zoom = 12)
Map$addLayer(Trueimage, visParams = trueColor) |
Map$addLayer(eeObject =NDVI, visParams = list(
min=0.2,
max=0.8,
palette= cpt("grass_ndvi", 10)))
```
Column {data-width=500}
-----------------------------------------------------------------------
### Mapa de imagen satelital Lansatd 5 2003 - Sentinel2 2021 - NDVI
```{r}
Map$setCenter(-69.53968,-12.86636, zoom = 12)
Map$addLayer(L5_2003, visParams = trueCo) |
Map$addLayer(Trueimage, visParams = trueColor)
```